Skip to content

Fixed the bug where a nested GraphQLInputObjectType causing infinite get_arg_serializer recursive calls #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

JBrVJxsc
Copy link
Contributor

Sometimes a GraphQLInputObjectType could have a field that has/contains the same type of it, in short, it is nested.

As get_arg_serializer is essentially a DFS and it did not handle this potential infinite recursive case.

This PR addressed this by caching/returning the serializer that was already created instead of stepping into the rabbit hole.

In the unit test, I added a test case test_nested_input_with_old_get_arg_serializer to reproduce the error. Feel free to remove it if you think testing with the good case is sufficient enough.

Copy link
Collaborator

@leszekhanusz leszekhanusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR!

@JBrVJxsc JBrVJxsc force-pushed the master branch 2 times, most recently from ceb46b5 to 67c8976 Compare August 15, 2020 20:05
@KingDarBoja KingDarBoja added the type: bug An issue or pull request relating to a bug label Aug 15, 2020
@leszekhanusz leszekhanusz merged commit fce2782 into graphql-python:master Aug 17, 2020
leszekhanusz pushed a commit to leruaa/gql that referenced this pull request Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants